{{template "header.html" . }}
{{/** TODO: Move this into a CSS file **/}}
{{template "socialgroups_css.html" . }}

{{/** TODO: Port the page template functions to the template interpreter **/}}
{{if gt .Page 1}}<div id="prevFloat" class="prev_button"><a class="prev_link" href="/guild/{{.Guild.ID}}?page={{subtract .Page 1}}">&lt;</a></div>{{end}}
{{if ne .LastPage .Page}}<link rel="prerender" href="/guild/{{.Guild.ID}}?page={{add .Page 1}}" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/guild/{{.Guild.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}

<div class="sgBackdrop">
	<nav class="miniMenu">
		<div class="menuItem"><a href="/guild/{{.Guild.ID}}">{{.Guild.Name}}</a></div>
		<div class="menuItem"><a href="#">About</a></div>
		<div class="menuItem"><a href="/guild/members/{{.Guild.ID}}">Members</a></div>
		<div class="menuItem rightMenu"><a href="#">Edit</a></div>
		<div class="menuItem rightMenu"><a href="/topics/create/{{.Forum.ID}}">Reply</a></div>
		<div class="menuItem rightMenu"><a href="/guild/join/{{.Guild.ID}}">Join</a></div>
	</nav>
	<div style="clear: both;"></div>
</div>
<main id="forum_topic_list" class="rowblock topic_list" style="position:relative;z-index:50;">
	{{range .ItemList}}<div class="rowitem topic_left passive datarow" style="background-image:url({{.Creator.Avatar}});background-position:left;background-repeat:no-repeat;background-size:64px;padding-left:72px;{{if .Sticky}}background-color:#FFFFCC;{{else if .IsClosed}}background-color:#eaeaea;{{end}}">
		<span class="topic_inner_right rowsmall" style="float:right;">
			<span class="replyCount">{{.PostCount}} replies</span><br>
			<span class="lastReplyAt">{{.LastReplyAt}}</span>
		</span>
		<span>
			<a class="rowtopic" href="{{.Link}}">{{.Title}}</a>
			<br><a class="rowsmall" href="{{.Creator.Link}}">Starter: {{.Creator.Name}}</a>
			{{if .IsClosed}}<span class="rowsmall topic_status_e topic_status_closed" title="{{lang "status.closed_tooltip"}}"> | &#x1F512;&#xFE0E{{end}}</span>
		</span>
	</div>
	<div class="rowitem topic_right passive datarow" style="background-image:url({{.LastUser.Avatar}});background-position:left;background-repeat:no-repeat;background-size:64px;padding-left:72px;">
		<span>
			<a href="{{.LastUser.Link}}" class="lastName" style="font-size:14px;">{{.LastUser.Name}}</a><br>
			<span class="rowsmall lastReplyAt">Last: {{.LastReplyAt}}</span>
		</span>
	</div>
	{{else}}<div class="rowitem passive">There aren't any topics in here yet.{{if .CurrentUser.Perms.CreateTopic}} <a href="/topics/create/{{.Forum.ID}}">Start one?</a>{{end}}</div>{{end}}
</main>
{{template "footer.html" . }}